home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / rendermap.scm < prev    next >
Encoding:
Text File  |  2005-06-30  |  2.9 KB  |  91 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2 of the License, or
  7. ; (at your option) any later version.
  8. ; This program is distributed in the hope that it will be useful,
  9. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ; GNU General Public License for more details.
  12. ; You should have received a copy of the GNU General Public License
  13. ; along with this program; if not, write to the Free Software
  14. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  
  16.  
  17. (define (script-fu-render-map inSize
  18.                   inGrain
  19.                   inGrad
  20.                   inWiden)
  21.   (let* (
  22.         (theWidth inSize)
  23.         (theHeight inSize)
  24.         (theImage (car (gimp-image-new theWidth theHeight RGB)))
  25.         (theLayer)
  26.         (thinLayer)
  27.         )
  28.  
  29.   (gimp-context-push)
  30.  
  31.   (gimp-selection-all theImage)
  32.  
  33.   (set! theLayer (car (gimp-layer-new theImage theWidth theHeight
  34.                       RGBA-IMAGE
  35.                       "I've got more rubber ducks than you!"
  36.                       100 NORMAL-MODE)))
  37.   (gimp-image-add-layer theImage theLayer 0)
  38.   (plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536)
  39.                inGrain inGrain inGrain)
  40.  
  41.   (if (= inWiden 1)
  42.       (begin
  43.     (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight
  44.                          RGBA-IMAGE "Camo Thin Layer"
  45.                          100 NORMAL-MODE)))
  46.     (gimp-image-add-layer theImage thinLayer 0)
  47.  
  48.     (let ((theBigGrain (min 15 (* 2 inGrain))))
  49.       (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536)
  50.                    theBigGrain theBigGrain theBigGrain))
  51.  
  52.     (gimp-context-set-background '(255 255 255))
  53.     (gimp-context-set-foreground '(0 0 0))
  54.  
  55.     (let ((theMask (car (gimp-layer-create-mask thinLayer 0))))
  56.       (gimp-layer-add-mask thinLayer theMask)
  57.  
  58.       (gimp-edit-blend theMask FG-BG-RGB-MODE NORMAL-MODE
  59.                GRADIENT-LINEAR 100 0 REPEAT-TRIANGULAR FALSE
  60.                FALSE 0 0 TRUE
  61.                0 0 0 (/ theHeight 2)))
  62.  
  63.     (set! theLayer (car(gimp-image-flatten theImage)))))
  64.     
  65.   (gimp-selection-none theImage)
  66.   (gimp-context-set-gradient inGrad)
  67.   (plug-in-gradmap TRUE theImage theLayer)
  68.  
  69.   (gimp-display-new theImage)
  70.  
  71.   (gimp-context-pop)))
  72.  
  73. (script-fu-register "script-fu-render-map"
  74.             _"Render _Map..."
  75.             "Another pattern which resembles a map"
  76.             "Chris Gutteridge: cjg@ecs.soton.ac.uk"
  77.             "28th April 1998"
  78.             "Chris Gutteridge / ECS @ University of Southampton, England"
  79.             ""
  80.             SF-ADJUSTMENT _"Image size"       '(256 0 2048 1 10 0 0)
  81.             SF-ADJUSTMENT _"Granularity"      '(4 0 15 1 1 0 0)
  82.             SF-GRADIENT   _"Gradient"         "Land and Sea"
  83.             SF-TOGGLE     _"Gradient reverse" FALSE
  84.             SF-OPTION     _"Behaviour"        '(_"Tile"
  85.                             _"Detail in Middle"))
  86.  
  87. (script-fu-menu-register "script-fu-render-map"
  88.              _"<Toolbox>/Xtns/Script-Fu/Patterns")
  89.